package com.abhi.apache.cxf.interfaces.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.sound.midi.Sequence;

import com.abhi.apache.cxf.interfaces.WebServiceInterface;
import com.abhi.apache.cxf.model.Address;
import com.abhi.apache.cxf.model.Login;

@WebService(endpointInterface = "com.abhi.apache.cxf.interfaces.WebServiceInterface",
            serviceName = "WebService")
public class WebServiceInterfaceImpl implements WebServiceInterface{

	@Override
	public Login getLogin(Long id) {
		Login login=new Login();
		login.setId(new Long(10001));
		login.setFirstName("Abhijit");
		login.setLastName("Dey");
		login.setUserName("abhi");
		login.setPassword("PASSWORD SET");
		login.setUserRole("ADMIN");
		return login;
	}

	@Override
	public Login createLogin(Login login) {
		Login result=(Login)login;
		result.setId(new Random(10002).nextLong());
		return result;
	}

	@Override
	public List<Address> getAddress() {
		List<Address> addresses=new ArrayList<Address>();
		Address address1=new Address();
		address1.setAddressId(new Random(1).nextLong());
		address1.setAddressLine1("Bhattacharya Para");
		address1.setAddressLine2("");
		address1.setAddressLine3("Ward No 6");
		address1.setCity("Suri");
		address1.setState("West Bengal");
		address1.setCountry("India");
		address1.setPin("731101");
		
		Address address2=new Address();
		address2.setAddressId(new Random(1).nextLong());
		address2.setAddressLine1("Barui Para");
		address2.setAddressLine2("");
		address2.setAddressLine3("Chittaranjan");
		address2.setCity("Asansol");
		address2.setState("West Bengal");
		address2.setCountry("India");
		address2.setPin("720001");
		
		addresses.add(address1);
		addresses.add(address2);
		
		return addresses;
	}

	@Override
	public Address getAddressCdata() {
		// TODO Auto-generated method stub
		Address address1=new Address();
		address1.setAddressId(new Random(1).nextLong());
		address1.setAddressLine1("Bhattacharya Para");
		address1.setAddressLine2("");
		address1.setAddressLine3("Ward No 6");
		address1.setCity("Suri");
		address1.setState("West Bengal");
		address1.setCountry("India");
		address1.setPin("731101");
		return address1;
	}

}
